<?php
namespace App\Exports;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\FromArray;

class OneExport implements WithHeadings,FromArray
{
    
    protected $head;
    protected $arr;
    public function __construct(array $head,array $arr)
    {
        $this->head=$head;
        $this->arr=$arr;
    }

    // 设置表头
    public function headings() : array
    {
        return $this->head;
    }

    //注意返回的二维数组，数组中的每一个数组代表一行
    public function array() : array
    {
        return $this->arr;
    }
}